<template>
    <base-dialog v-bind="$attrs" v-on="$listeners" title="请输入意见:" size="tiny" @submit="toSubmit" :disabled="false">
        <el-input  type="textarea" v-model="suggestion" clearable :style="{width: '100%'}" :autosize="{minRows: 4, maxRows: 4}">
        </el-input>
        <template slot="other-btn">
            <more-msg-fixed @setSuggestion="setSuggestion" style="margin-left: 10px;" size="medium"></more-msg-fixed>
        </template>
    </base-dialog>
</template>
<script>
    import BaseDialog from "../../Common/BaseDialog";
    import MoreMsgFixed from "../../Common/MoreMsgFixed";
    export default {
        components: {MoreMsgFixed, BaseDialog},
        name:"SimpleSuggestionDialog",
        props:["defaultSuggestion"],
        data(){
            return{
                suggestion:""
            }
        },
        created() {
            this.suggestion = this.defaultSuggestion
        },
        computed:{
        },
        methods:{
            setSuggestion(msg){
                this.suggestion = msg
            },
            toSubmit(){
                if(this.suggestion){
                    this.$emit("update:defaultSuggestion",this.suggestion)
                    this.$emit("suggestionCallback")
                }else{
                    this.msgError("意见不能为空!")
                }
            }
        }
    }
</script>
